﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management;
using System.Diagnostics;

namespace Kodi.Picturethrill
{
    public static class ExtensionMethods
    {
        public static string GetCommandLine(this Process process)
        {
            int processId = process.Id;

            ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Process WHERE ProcessId=" + processId);
            foreach (ManagementObject win32Process in searcher.Get())
            {
                return win32Process["CommandLine"].ToString();
            }

            return string.Empty;
        }
    }
}
